<template>
  <div class="tab-bar-com">
    <!-- <div class="delete list-item-clearfix" v-show="showDelete">
          <span class="pull_left">{{item.text}}</span>
          <span class="pull_right" @click.stop="deleteCurItem(item,index)">删除</span>
          </div> -->

    <div v-if="item.stylesType == 2" class="styleOne list-item-clearfix">
      <div v-for="(imgItem, imgIndex) in oneArr" :key="imgIndex" class="item">
        <div class="imgsT">
          <img :src="imgItem.src" />
        </div>
        <p>{{ imgItem.substance }}</p>
      </div>
    </div>
    <div v-if="item.stylesType == 1" class="styleOne list-item-clearfix">
      <div v-for="(imgItem, imgIndex) in twoArr" :key="imgIndex" class="item">
        <div class="imgsF">
          <img :src="imgItem.src" />
        </div>
        <p>{{ imgItem.substance }}</p>
      </div>
    </div>
    <div v-if="item.stylesType == 0" class="styleOne list-item-clearfix">
      <div
        v-for="(imgItem, imgIndex) in item.imgUrls"
        :key="imgIndex"
        class="item"
      >
        <div class="imgsF">
          <img :src="imgItem.src" />
        </div>
        <p>{{ imgItem.substance }}</p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    item: {
      type: Object,
      default: () => {}
    },
    index: {
      type: Number,
      default: -1
    },
    showDelete: {
      type: Boolean,
      default: false
    }
  },
  computed: {
    oneArr() {
      let arr = this.item.imgUrls.filter((ele, i) => {
        if (i < 3) return ele;
      });
      return arr;
    },
    twoArr() {
      let arr = this.item.imgUrls.filter((ele, i) => {
        if (i < 4) return ele;
      });
      return arr;
    }
  },
  methods: {
    deleteCurItem(e, i) {
      this.$emit("deleteCurItem", e, i);
    }
  }
};
</script>

<style lang="scss" scoped>
.tab-bar-com {
  width: 98.5%;
  z-index: 999;
  position: absolute;
  bottom: 0;
  font-size: 12px;
  color: #595961;
  height: 70px;
  background-color: #fff;
  text-align: center;
  .styleOne {
    display: flex;
    .item {
      flex: 1px;
      .imgsT {
        width: 32px;
        height: 32px;
        margin: 10px auto 4px auto;
        overflow: hidden;
        padding-left: 2px;
        img {
          width: 62px;
        }
      }
      .imgsF {
        width: 32px;
        height: 32px;
        margin: 10px auto 4px auto;
        overflow: hidden;
        img {
          width: 62px;
          padding-left: 2px;
        }
      }
    }
  }
}
</style>
